; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -dse -S %s | FileCheck %s

target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"

; Make sure we do not crash when we encounter unreachable blocks while checking
; if all paths to DomAccess go through a killing block.
define void @test(float* %ptr, i1 %c.1, i1 %c.2, i1 %c.3) {
; CHECK-LABEL: @test(
; CHECK-NEXT:  bb:
; CHECK-NEXT:    br i1 [[C_1:%.*]], label [[BB27:%.*]], label [[BB53:%.*]]
; CHECK:       bb10:
; CHECK-NEXT:    br label [[BB43:%.*]]
; CHECK:       bb22:
; CHECK-NEXT:    br i1 [[C_2:%.*]], label [[BB22:%.*]], label [[BB53]]
; CHECK:       bb27:
; CHECK-NEXT:    br i1 [[C_3:%.*]], label [[BB38:%.*]], label [[BB39:%.*]]
; CHECK:       bb38:
; CHECK-NEXT:    store float 0.000000e+00, float* [[PTR:%.*]], align 4
; CHECK-NEXT:    br label [[BB38]]
; CHECK:       bb39:
; CHECK-NEXT:    br i1 [[C_2]], label [[BB43]], label [[BB38]]
; CHECK:       bb43:
; CHECK-NEXT:    store float 0.000000e+00, float* [[PTR]], align 4
; CHECK-NEXT:    br label [[BB50:%.*]]
; CHECK:       bb50:
; CHECK-NEXT:    br i1 [[C_3]], label [[BB27]], label [[BB53]]
; CHECK:       bb53:
; CHECK-NEXT:    br label [[BB53]]
;
bb:
  br i1 %c.1, label %bb27, label %bb53

bb10:                                             ; No predecessors!
  br label %bb43

bb22:                                             ; preds = %bb22
  br i1 %c.2, label %bb22, label %bb53

bb27:                                             ; preds = %bb50, %bb
  br i1 %c.3, label %bb38, label %bb39

bb38:                                             ; preds = %bb39, %bb38, %bb27
  store float 0.000000e+00, float* %ptr, align 4
  br label %bb38

bb39:                                             ; preds = %bb27
  br i1 %c.2, label %bb43, label %bb38

bb43:                                             ; preds = %bb39, %bb10
  store float 0.000000e+00, float* %ptr, align 4
  br label %bb50

bb50:                                             ; preds = %bb43
  br i1 %c.3, label %bb27, label %bb53

bb53:                                             ; preds = %bb53, %bb50, %bb22, %bb
  br label %bb53
}
